/**
 * 
 */
package org.yelongframework.model.support.spring.jdbc;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

import org.springframework.transaction.annotation.Transactional;
import org.yelongframework.model.Modelable;
import org.yelongframework.model.collector.ModelCollector;
import org.yelongframework.model.service.AbstractSqlModelService;
import org.yelongframework.model.service.SqlModelService;
import org.yelongframework.model.service.configuration.ModelServiceConfiguration;
import org.yelongframework.model.service.function.ModelServiceConsumer;
import org.yelongframework.model.service.function.ModelServiceFunction;
import org.yelongframework.model.service.function.ModelServiceOperation;
import org.yelongframework.model.service.function.ModelServiceSupplier;
import org.yelongframework.model.sql.model.SqlModel;
import org.yelongframework.sql.fragment.condition.ConditionSqlFragment;
import org.yelongframework.sql.fragment.count.CountSqlFragment;
import org.yelongframework.sql.fragment.delete.DeleteSqlFragment;
import org.yelongframework.sql.fragment.group.GroupSqlFragment;
import org.yelongframework.sql.fragment.insert.InsertSqlFragment;
import org.yelongframework.sql.fragment.order.OrderSqlFragment;
import org.yelongframework.sql.fragment.select.SelectSqlFragment;
import org.yelongframework.sql.fragment.update.UpdateSqlFragment;

/**
 * 存在事务的modelService
 * 
 * 由于{@link Transactional}注解不适用于父类方法，所以在此抽象类中将{@link SqlModelService}包含及其父类中所有的方法实现默认实现，以实现事务
 * 
 * @since 1.0.0
 */
@Transactional
public abstract class TransactionalSqlModelService extends AbstractSqlModelService {

	// ==================================================constructor==================================================

	public TransactionalSqlModelService(ModelServiceConfiguration modelServiceConfiguration) {
		super(modelServiceConfiguration);
	}

	// ==================================================SqlFragmentExecutor==================================================

	@Override
	public Integer execute(InsertSqlFragment insertSqlFragment) {
		return super.execute(insertSqlFragment);
	}

	@Override
	public Integer execute(DeleteSqlFragment deleteSqlFragment) {
		return super.execute(deleteSqlFragment);
	}

	@Override
	public Integer execute(UpdateSqlFragment updateSqlFragment) {
		return super.execute(updateSqlFragment);
	}

	@Override
	public Long execute(CountSqlFragment countSqlFragment) {
		return super.execute(countSqlFragment);
	}

	@Override
	public List<Map<String, Object>> execute(SelectSqlFragment selectSqlFragment) {
		return super.execute(selectSqlFragment);
	}

	@Override
	public <T> T execute(SelectSqlFragment selectSqlFragment, Function<SelectSqlFragment, T> executor) {
		return super.execute(selectSqlFragment, executor);
	}

	// ==================================================ModelSqlFragmentExecutor==================================================

	@Override
	public boolean save(Class<? extends Modelable> modelClass, Map<String, Object> saveAttributes) {
		return super.save(modelClass, saveAttributes);
	}

	@Override
	public Integer removeBySqlFragment(Class<? extends Modelable> modelClass,
			ConditionSqlFragment conditionSqlFragment) {
		return super.removeBySqlFragment(modelClass, conditionSqlFragment);
	}

	@Override
	public Integer modifyBySqlFragment(Class<? extends Modelable> modelClass, Map<String, Object> modifyAttributes,
			ConditionSqlFragment conditionSqlFragment) {
		return super.modifyBySqlFragment(modelClass, modifyAttributes, conditionSqlFragment);
	}

	@Override
	public Integer modifyBySqlFragment(String updateSql, Object[] updateSqlParams,
			ConditionSqlFragment conditionSqlFragment) {
		return super.modifyBySqlFragment(updateSql, updateSqlParams, conditionSqlFragment);
	}

	@Override
	public Long countBySqlFragment(Class<? extends Modelable> modelClass, ConditionSqlFragment conditionSqlFragment) {
		return super.countBySqlFragment(modelClass, conditionSqlFragment);
	}

	@Override
	public Long countBySqlFragment(String countSql, Object[] countSqlParams,
			ConditionSqlFragment conditionSqlFragment) {
		return super.countBySqlFragment(countSql, countSqlParams, conditionSqlFragment);
	}

	@Override
	public <M extends Modelable> List<M> findBySqlFragment(Class<M> modelClass,
			ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findBySqlFragment(modelClass, conditionSqlFragment, groupSqlFragment, orderSqlFragment);
	}

	@Override
	public <M extends Modelable> List<M> findBySqlFragment(Class<M> modelClass, String selectSql,
			Object[] selectSqlParams, ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findBySqlFragment(modelClass, selectSql, selectSqlParams, conditionSqlFragment, groupSqlFragment,
				orderSqlFragment);
	}

	@Override
	public <M extends Modelable> List<M> findBySQL(Class<M> modelClass, String selectSql, Object[] params) {
		return super.findBySQL(modelClass, selectSql, params);
	}

	@Override
	public <M extends Modelable> M findFirstBySqlFragment(Class<M> modelClass,
			ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findFirstBySqlFragment(modelClass, conditionSqlFragment, groupSqlFragment, orderSqlFragment);
	}

	@Override
	public <M extends Modelable> M findFirstBySqlFragment(Class<M> modelClass, String selectSql,
			Object[] selectSqlParams, ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findFirstBySqlFragment(modelClass, selectSql, selectSqlParams, conditionSqlFragment,
				groupSqlFragment, orderSqlFragment);
	}

	@Override
	public <M extends Modelable> M findFirstBySQL(Class<M> modelClass, String sql, Object[] params) {
		return super.findFirstBySQL(modelClass, sql, params);
	}

	@Override
	public <T> List<T> findSingleColumnBySqlFragment(Class<? extends Modelable> modelClass, String selectColumn,
			ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findSingleColumnBySqlFragment(modelClass, selectColumn, conditionSqlFragment, groupSqlFragment,
				orderSqlFragment);
	}

	@Override
	public <T> T findFirstSingleColumnBySqlFragment(Class<? extends Modelable> modelClass, String selectColumn,
			ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findFirstSingleColumnBySqlFragment(modelClass, selectColumn, conditionSqlFragment,
				groupSqlFragment, orderSqlFragment);
	}

	@Override
	public <T> List<T> findSingleColumnBySqlFragment(String selectSql, Object[] selectSqlParams,
			ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findSingleColumnBySqlFragment(selectSql, selectSqlParams, conditionSqlFragment, groupSqlFragment,
				orderSqlFragment);
	}

	@Override
	public <T> T findFirstSingleColumnBySqlFragment(String selectSql, Object[] selectSqlParams,
			ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment) {
		return super.findFirstSingleColumnBySqlFragment(selectSql, selectSqlParams, conditionSqlFragment,
				groupSqlFragment, orderSqlFragment);
	}

	@Override
	public <M extends Modelable> List<M> findPageBySqlFragment(Class<M> modelClass,
			ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment, int pageNum, int pageSize) {
		return super.findPageBySqlFragment(modelClass, conditionSqlFragment, groupSqlFragment, orderSqlFragment,
				pageNum, pageSize);
	}

	@Override
	public <M extends Modelable> List<M> findPageBySqlFragment(Class<M> modelClass, String selectSql,
			Object[] selectSqlParams, ConditionSqlFragment conditionSqlFragment, GroupSqlFragment groupSqlFragment,
			OrderSqlFragment orderSqlFragment, int pageNum, int pageSize) {
		return super.findPageBySqlFragment(modelClass, selectSql, selectSqlParams, conditionSqlFragment,
				groupSqlFragment, orderSqlFragment, pageNum, pageSize);
	}

	@Override
	public <M extends Modelable> List<M> findPageBySQL(Class<M> modelClass, String selectSql, Object[] params,
			int pageNum, int pageSize) {
		return super.findPageBySQL(modelClass, selectSql, params, pageNum, pageSize);
	}

	// ==================================================ModelService==================================================

	@Override
	public boolean save(Modelable model) {
		return super.save(model);
	}

	@Override
	public boolean saveSelective(Modelable model) {
		return super.saveSelective(model);
	}

	@Override
	public Integer modifyBySqlFragment(Modelable model, ConditionSqlFragment conditionSqlFragment) {
		return super.modifyBySqlFragment(model, conditionSqlFragment);
	}

	@Override
	public Integer modifySelectiveBySqlFragment(Modelable model, ConditionSqlFragment conditionSqlFragment) {
		return super.modifySelectiveBySqlFragment(model, conditionSqlFragment);
	}

	// ==================================================SqlModelService==================================================

	@Override
	public Integer removeBySqlModel(Class<? extends Modelable> modelClass, SqlModel sqlModel) {
		return super.removeBySqlModel(modelClass, sqlModel);
	}

	@Override
	public Integer modifyBySqlModel(Modelable model, SqlModel sqlModel) {
		return super.modifyBySqlModel(model, sqlModel);
	}

	@Override
	public Integer modifySelectiveBySqlModel(Modelable model, SqlModel sqlModel) {
		return super.modifySelectiveBySqlModel(model, sqlModel);
	}

	@Override
	public Long countBySqlModel(Class<? extends Modelable> modelClass, SqlModel sqlModel) {
		return super.countBySqlModel(modelClass, sqlModel);
	}

	@Override
	public Long countBySqlModel(String countSql, Object[] countSqlParams, SqlModel sqlModel) {
		return super.countBySqlModel(countSql, countSqlParams, sqlModel);
	}

	@Override
	public <M extends Modelable> List<M> findBySqlModel(Class<M> modelClass, SqlModel sqlModel) {
		return super.findBySqlModel(modelClass, sqlModel);
	}

	@Override
	public <M extends Modelable> List<M> findBySqlModel(Class<M> modelClass, String selectSql, Object[] selectSqlParams,
			SqlModel sqlModel) {
		return super.findBySqlModel(modelClass, selectSql, selectSqlParams, sqlModel);
	}

	@Override
	public <M extends Modelable> M findFirstBySqlModel(Class<M> modelClass, SqlModel sqlModel) {
		return super.findFirstBySqlModel(modelClass, sqlModel);
	}

	@Override
	public <M extends Modelable> M findFirstBySqlModel(Class<M> modelClass, String selectSql, Object[] selectSqlParams,
			SqlModel sqlModel) {
		return super.findFirstBySqlModel(modelClass, selectSql, selectSqlParams, sqlModel);
	}

	@Override
	public <T> List<T> findSingleColumnBySqlModel(Class<? extends Modelable> modelClass, String selectColumn,
			SqlModel sqlModel) {
		return super.findSingleColumnBySqlModel(modelClass, selectColumn, sqlModel);
	}

	@Override
	public <T> List<T> findSingleColumnBySqlModel(String selectSql, Object[] selectSqlParams, SqlModel sqlModel) {
		return super.findSingleColumnBySqlModel(selectSql, selectSqlParams, sqlModel);
	}

	@Override
	public <T> T findFirstSingleColumnBySqlModel(Class<? extends Modelable> modelClass, String selectColumn,
			SqlModel sqlModel) {
		return super.findFirstSingleColumnBySqlModel(modelClass, selectColumn, sqlModel);
	}

	@Override
	public <T> T findFirstSingleColumnBySqlModel(String selectSql, Object[] selectSqlParams, SqlModel sqlModel) {
		return super.findFirstSingleColumnBySqlModel(selectSql, selectSqlParams, sqlModel);
	}

	@Override
	public <M extends Modelable> List<M> findPageBySqlModel(Class<M> modelClass, SqlModel sqlModel, int pageNum,
			int pageSize) {
		return super.findPageBySqlModel(modelClass, sqlModel, pageNum, pageSize);
	}

	@Override
	public <M extends Modelable> List<M> findPageBySqlModel(Class<M> modelClass, String selectSql,
			Object[] selectSqlParams, SqlModel sqlModel, int pageNum, int pageSize) {
		return super.findPageBySqlModel(modelClass, selectSql, selectSqlParams, sqlModel, pageNum, pageSize);
	}

	@Override
	public <M extends Modelable, R, T extends ModelCollector<M, R, T>> R collect(
			ModelCollector<M, R, T> modelCollector) {
		return super.collect(modelCollector);
	}

	@Override
	public <R> R doFunction(ModelServiceFunction<R> function) {
		return super.doFunction(function);
	}

	@Override
	public void doConsumer(ModelServiceConsumer consumer) {
		super.doConsumer(consumer);
	}

	@Override
	public void doOperation(ModelServiceOperation operation) {
		super.doOperation(operation);
	}

	@Override
	public <R> R doSupplier(ModelServiceSupplier<R> supplier) {
		return super.doSupplier(supplier);
	}

}
